package global.com.loansapplication.ui.fragment.biz;

import java.util.List;

import global.com.loansapplication.base.BaseBean;
import global.com.loansapplication.base.BaseBiz;
import global.com.loansapplication.base.BaseResp;
import global.com.loansapplication.bean.BannerInfo;
import global.com.loansapplication.bean.ClueInfo;
import global.com.loansapplication.comm.BaseSubscribe2;
import global.com.loansapplication.comm.RetrofitHelp;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by chenjian on 17/11/30.
 */

public class ClueBiz extends BaseBiz {

    /**
     * 获取banner图
     *
     * @param
     * @param callback
     */
    public void getBannerList(Integer pageNum, Integer pagesize,final BaseBiz.Callback<BaseBean<List<BannerInfo>>> callback) {
        com.add(RetrofitHelp.getSecretApi().bannerList(pageNum,pagesize)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe2<BaseResp<BaseBean<List<BannerInfo>>>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((BaseBean<List<BannerInfo>>)obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((BaseBean<List<BannerInfo>>)obj);
                    }
                })
        );
    }

   
    /**
     * 获取线索列表图
     *
     * @param callback
     */
    public void getClueList(String userCode, Integer pageNum, Integer pagesize,String cityIds, Integer customerType, Integer month,Integer havecar,
                            Integer havehouse,Integer haveCreditCard,Integer haveShebao,Integer haveGongjijin,Integer haveBaodan,Integer haveYibao,
                            final BaseBiz.Callback<BaseBean<List<ClueInfo>>> callback) {
        com.add(RetrofitHelp.getSecretApi().userList(userCode, pageNum, pagesize,cityIds, customerType, month,havecar,
                havehouse, haveCreditCard, haveShebao,haveGongjijin,haveBaodan, haveYibao)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe2<BaseResp<BaseBean<List<ClueInfo>>>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((BaseBean<List<ClueInfo>>) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((BaseBean<List<ClueInfo>>) obj);
                    }
                })
        );
    }
}
